/*
 Navicat Premium Data Transfer

 Source Server         : TestLink
 Source Server Type    : MySQL
 Source Server Version : 80016
 Source Host           : localhost:3306
 Source Schema         : train

 Target Server Type    : MySQL
 Target Server Version : 80016
 File Encoding         : 65001

 Date: 06/10/2022 00:11:55
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sys_admin
-- ----------------------------
DROP TABLE IF EXISTS `sys_admin`;
CREATE TABLE `sys_admin` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `token_salt` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'token的密钥',
  `icon` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '头像',
  `email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '邮箱',
  `nick_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '昵称',
  `note` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注信息',
  `create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `login_time` datetime DEFAULT NULL COMMENT '最后登录时间',
  `status` int(11) DEFAULT '1' COMMENT '帐号启用状态：0->禁用；1->启用',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='后台用户表';

-- ----------------------------
-- Records of sys_admin
-- ----------------------------
BEGIN;
INSERT INTO `sys_admin` VALUES (3, 'user4', '$2a$10$gZmu2Tq6BILNGyOwt.foWOJNivA5ufJPMA1d6lq.BRMBChhtffPde', '$2a$10$abkg9JL5GUDCrhP7vRHSCu', 'icon/etstssss', 'asdfasdf@qq.com', 'user4', NULL, '2022-09-25 00:11:49', NULL, 1);
INSERT INTO `sys_admin` VALUES (9, 'Test', '$2a$10$gZmu2Tq6BILNGyOwt.foWOJNivA5ufJPMA1d6lq.BRMBChhtffPde', '$2a$10$xnu3UHc4b/Y37QPOwwqGDe', NULL, 'asdf@qq.com', 'asdf', 'daf', '2022-08-11 00:00:10', NULL, 1);
INSERT INTO `sys_admin` VALUES (10, 'user1', '$2a$10$gZmu2Tq6BILNGyOwt.foWOJNivA5ufJPMA1d6lq.BRMBChhtffPde', '$2a$10$abkg9JL5GUDCrhP7vRHSCu', 'icon/etstssss', 'user1@qq.com', 'user1', 'sasf', '2022-09-23 00:46:44', NULL, 0);
INSERT INTO `sys_admin` VALUES (13, 'ADMIN', '$2a$10$gZmu2Tq6BILNGyOwt.foWOJNivA5ufJPMA1d6lq.BRMBChhtffPde', 'd', NULL, NULL, 'admin_1', NULL, '2022-10-05 16:07:12', NULL, 1);
COMMIT;

-- ----------------------------
-- Table structure for sys_admin_permission_relation
-- ----------------------------
DROP TABLE IF EXISTS `sys_admin_permission_relation`;
CREATE TABLE `sys_admin_permission_relation` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `admin_id` bigint(20) DEFAULT NULL,
  `permission_id` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='后台用户和权限关系表(除角色中定义的权限以外的加减权限)';

-- ----------------------------
-- Records of sys_admin_permission_relation
-- ----------------------------
BEGIN;
INSERT INTO `sys_admin_permission_relation` VALUES (1, 9, 20);
COMMIT;

-- ----------------------------
-- Table structure for sys_admin_role_relation
-- ----------------------------
DROP TABLE IF EXISTS `sys_admin_role_relation`;
CREATE TABLE `sys_admin_role_relation` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `admin_id` bigint(20) DEFAULT NULL,
  `role_id` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='后台用户和角色关系表';

-- ----------------------------
-- Records of sys_admin_role_relation
-- ----------------------------
BEGIN;
INSERT INTO `sys_admin_role_relation` VALUES (1, 9, 1);
INSERT INTO `sys_admin_role_relation` VALUES (34, 13, 1);
INSERT INTO `sys_admin_role_relation` VALUES (62, 3, 20);
INSERT INTO `sys_admin_role_relation` VALUES (63, 3, 21);
INSERT INTO `sys_admin_role_relation` VALUES (64, 3, 23);
INSERT INTO `sys_admin_role_relation` VALUES (65, 3, 24);
INSERT INTO `sys_admin_role_relation` VALUES (66, 3, 26);
COMMIT;

-- ----------------------------
-- Table structure for sys_permission
-- ----------------------------
DROP TABLE IF EXISTS `sys_permission`;
CREATE TABLE `sys_permission` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `pid` bigint(20) DEFAULT NULL COMMENT '父级权限id',
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '名称',
  `req_url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'API请求URL',
  `req_method` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'API请求方法',
  `perms` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '权限标识',
  `vue_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '前端请求URL',
  `vue_component` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '前端资源路径',
  `icon` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '图标',
  `type` int(11) DEFAULT '1' COMMENT '权限类型：0->目录；1->菜单；2->按钮（接口绑定权限）',
  `status` int(11) DEFAULT '1' COMMENT '启用状态；0->禁用；1->启用',
  `create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `sort` int(11) DEFAULT NULL COMMENT '显示排序',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='后台用户权限表';

-- ----------------------------
-- Records of sys_permission
-- ----------------------------
BEGIN;
INSERT INTO `sys_permission` VALUES (1, 0, '系统管理', NULL, NULL, NULL, '/sys', NULL, NULL, 0, 1, '2022-09-14 14:15:24', 1);
INSERT INTO `sys_permission` VALUES (2, 0, '测试列表', NULL, NULL, NULL, '/test', NULL, NULL, 0, 1, '2022-09-14 21:17:44', 2);
INSERT INTO `sys_permission` VALUES (20, 1, '用户管理', '/admin/list', 'GET', 'sys:user:view', '/admin', '/security/admin', NULL, 1, 1, '2022-09-29 11:08:15', 1);
INSERT INTO `sys_permission` VALUES (21, 1, '角色管理', '/role/list', 'POST', 'sys:role:view', '/role', '/security/role', NULL, 1, 1, '2022-09-29 11:08:24', 3);
INSERT INTO `sys_permission` VALUES (22, 1, '权限管理', '/permission/list', 'GET', 'sys:perm:view', '/permission', '/security/permission', NULL, 1, 1, '2022-09-29 11:08:34', 2);
INSERT INTO `sys_permission` VALUES (23, 2, '测试1', '/test', 'POST', 'test:1:view', '/test1', '/test/test1/index', NULL, 1, 1, '2022-09-29 11:08:47', 3);
INSERT INTO `sys_permission` VALUES (24, 2, '测试2', '/test', 'GET', 'test:2:view', '/test2', '/test/test2/test2', NULL, 1, 1, '2022-09-29 11:08:52', 1);
INSERT INTO `sys_permission` VALUES (25, 20, '用户更新', '/admin', 'PUT', 'sys:user:update', NULL, NULL, NULL, 2, 1, '2022-09-29 11:09:09', 999);
INSERT INTO `sys_permission` VALUES (26, 20, '用户角色分配', '/admin/updateAdminRole', 'POST', 'sys:user:roleassign', NULL, NULL, NULL, 2, 1, '2022-09-29 11:09:28', 999);
INSERT INTO `sys_permission` VALUES (27, 20, '用户删除', '/admin/{id}', 'DELETE', 'sys:user:del', NULL, NULL, NULL, 2, 1, '2022-09-29 11:09:33', 999);
INSERT INTO `sys_permission` VALUES (28, 20, '用户单个查询', '/admin/{id}', 'GET', 'sys:user:query', NULL, NULL, NULL, 2, 1, '2022-09-29 11:09:46', 999);
INSERT INTO `sys_permission` VALUES (29, 20, '用户增加', '/admin/register', 'POST', 'sys:user:add', NULL, NULL, NULL, 2, 1, '2022-09-29 11:09:50', 999);
INSERT INTO `sys_permission` VALUES (30, 22, '权限增加', '/permission', 'POST', 'sys:perm:add', NULL, NULL, NULL, 2, 1, '2022-09-29 11:09:56', 999);
INSERT INTO `sys_permission` VALUES (31, 22, '权限更新', '/permission', 'PUT', 'sys:perm:update', NULL, NULL, NULL, 2, 1, '2022-09-29 11:10:01', 999);
INSERT INTO `sys_permission` VALUES (32, 22, '权限删除', '/permission/{id}', 'DELETE', 'sys:perm:del', NULL, NULL, NULL, 2, 1, '2022-09-29 11:10:06', 999);
INSERT INTO `sys_permission` VALUES (33, 22, '权限单个查询', '/permission/{id}', 'GET', 'sys:perm:query', NULL, NULL, NULL, 2, 1, '2022-09-29 11:10:12', 999);
INSERT INTO `sys_permission` VALUES (35, 21, '角色增加', '/role', 'POST', 'sys:role:add', NULL, NULL, NULL, 2, 1, '2022-09-29 11:10:45', 999);
INSERT INTO `sys_permission` VALUES (36, 21, '角色更新', '/role', 'PUT', 'sys:role:update', NULL, NULL, NULL, 2, 1, '2022-09-29 11:11:03', 999);
INSERT INTO `sys_permission` VALUES (37, 21, '角色删除', '/role/{id}', 'DELETE', 'sys:role:del', NULL, NULL, NULL, 2, 1, '2022-09-29 11:11:08', 999);
INSERT INTO `sys_permission` VALUES (38, 21, '角色单个查询', '/role/{id}', 'GET', 'sys:role:query', NULL, NULL, NULL, 2, 1, '2022-09-29 11:11:13', 999);
INSERT INTO `sys_permission` VALUES (39, 23, '测试1-1', '/test/sub/{id}', 'GET', 'test:1:query', '/test1-1', '/test/test1/test1-1/test1-1', NULL, 1, 1, '2022-09-29 11:11:23', 999);
INSERT INTO `sys_permission` VALUES (40, 23, '测试1-2', '/test/sub/{id}', 'GET', 'test:2:query', '/test1-2', '/test/test1/test1-2', NULL, 1, 1, '2022-09-29 11:11:29', 999);
COMMIT;

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '名称',
  `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述',
  `admin_count` int(11) DEFAULT NULL COMMENT '后台用户数量',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `status` int(11) DEFAULT '1' COMMENT '启用状态：0->禁用；1->启用',
  `sort` int(11) DEFAULT '0',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='后台用户角色表';

-- ----------------------------
-- Records of sys_role
-- ----------------------------
BEGIN;
INSERT INTO `sys_role` VALUES (1, 'ADMIN', '超级管理员', NULL, '2022-09-25 17:31:29', 1, 0);
INSERT INTO `sys_role` VALUES (20, 'sys:user:view', '', NULL, '2022-10-05 16:32:00', 1, 0);
INSERT INTO `sys_role` VALUES (21, 'sys:user:add', '', NULL, '2022-10-05 16:32:09', 1, 0);
INSERT INTO `sys_role` VALUES (23, 'sys:user:del', '', NULL, '2022-10-05 16:32:49', 1, 0);
INSERT INTO `sys_role` VALUES (24, 'sys:user:update', '', NULL, '2022-10-05 16:33:39', 1, 0);
INSERT INTO `sys_role` VALUES (25, 'sys:user:roleassign', '', NULL, '2022-10-05 16:35:36', 1, 0);
INSERT INTO `sys_role` VALUES (26, 'sys:role:view', '', NULL, '2022-10-05 22:00:15', 1, 0);
INSERT INTO `sys_role` VALUES (27, 'sys:role:add', '', NULL, '2022-10-05 22:01:07', 1, 0);
INSERT INTO `sys_role` VALUES (28, 'sys:role:del', '', NULL, '2022-10-05 22:01:24', 1, 0);
INSERT INTO `sys_role` VALUES (29, 'sys:role:update', '', NULL, '2022-10-05 22:01:50', 1, 0);
INSERT INTO `sys_role` VALUES (30, 'sys:perm:view', '', NULL, '2022-10-05 22:02:22', 1, 0);
INSERT INTO `sys_role` VALUES (31, 'sys:perm:add', '', NULL, '2022-10-05 22:02:34', 1, 0);
INSERT INTO `sys_role` VALUES (32, 'sys:perm:del', '', NULL, '2022-10-05 22:02:49', 1, 0);
INSERT INTO `sys_role` VALUES (33, 'sys:perm:update', '', NULL, '2022-10-05 22:03:31', 1, 0);
COMMIT;

-- ----------------------------
-- Table structure for sys_role_permission_relation
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_permission_relation`;
CREATE TABLE `sys_role_permission_relation` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `role_id` bigint(20) DEFAULT NULL,
  `permission_id` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='后台用户角色和权限关系表';

-- ----------------------------
-- Records of sys_role_permission_relation
-- ----------------------------
BEGIN;
INSERT INTO `sys_role_permission_relation` VALUES (29, 10, 50);
INSERT INTO `sys_role_permission_relation` VALUES (30, 10, 51);
INSERT INTO `sys_role_permission_relation` VALUES (33, 11, 1);
INSERT INTO `sys_role_permission_relation` VALUES (34, 11, 2);
INSERT INTO `sys_role_permission_relation` VALUES (37, 20, 20);
INSERT INTO `sys_role_permission_relation` VALUES (38, 24, 25);
INSERT INTO `sys_role_permission_relation` VALUES (39, 25, 26);
INSERT INTO `sys_role_permission_relation` VALUES (40, 23, 27);
INSERT INTO `sys_role_permission_relation` VALUES (41, 21, 29);
INSERT INTO `sys_role_permission_relation` VALUES (42, 30, 22);
INSERT INTO `sys_role_permission_relation` VALUES (43, 33, 31);
INSERT INTO `sys_role_permission_relation` VALUES (44, 31, 30);
INSERT INTO `sys_role_permission_relation` VALUES (45, 32, 32);
INSERT INTO `sys_role_permission_relation` VALUES (46, 26, 21);
INSERT INTO `sys_role_permission_relation` VALUES (47, 27, 35);
INSERT INTO `sys_role_permission_relation` VALUES (48, 29, 36);
INSERT INTO `sys_role_permission_relation` VALUES (49, 28, 37);
COMMIT;

-- ----------------------------
-- Table structure for test
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of test
-- ----------------------------
BEGIN;
INSERT INTO `test` VALUES (1, 'asfd');
INSERT INTO `test` VALUES (2, 'asfd2');
INSERT INTO `test` VALUES (3, 'asf3');
INSERT INTO `test` VALUES (4, 'asfd4');
INSERT INTO `test` VALUES (5, 'asfd5');
INSERT INTO `test` VALUES (6, 'asfd6');
INSERT INTO `test` VALUES (7, 'asfd7');
INSERT INTO `test` VALUES (8, 'asfd8');
INSERT INTO `test` VALUES (9, 'asfd9');
INSERT INTO `test` VALUES (10, 'asfd10');
INSERT INTO `test` VALUES (11, 'asfd11');
INSERT INTO `test` VALUES (12, 'asfd12');
INSERT INTO `test` VALUES (13, 'asfd13');
COMMIT;

-- ----------------------------
-- Procedure structure for idata
-- ----------------------------
DROP PROCEDURE IF EXISTS `idata`;
delimiter ;;
CREATE PROCEDURE `train`.`idata`()
begin
  declare i int;
  set i=1;
  while(i<=100000)do
    insert into t values(i, i, i);
    set i=i+1;
  end while;
end
;;
delimiter ;

SET FOREIGN_KEY_CHECKS = 1;
